package com.jason.data.agentbase;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class AspectjTest {


    @Before("@annotation(com.jason.data.Test.MDS)")
    public void before(JoinPoint jp) {
        System.out.println("------aspect before----");
    }

//    @Around("@within(MDS) || @annotation(com.jason.data.Test.MDS)")
    @Around("@annotation(com.jason.data.Test.MDS)")
    public Object aroundAdvice(ProceedingJoinPoint pjp) throws Throwable {

        System.out.println("------aspect around----");
        return pjp.proceed();
    }

    @After("@annotation(com.jason.data.Test.MDS)")
    public void after(JoinPoint jp) {
        System.out.println("------aspect After----");
    }

    @AfterReturning("@annotation(com.jason.data.Test.MDS)")
    public void afterTurn(JoinPoint jp) {
        System.out.println("------aspect AfterReturning----");
    }


}
